﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DataTier
{
    class Shows
    {
        public List<Show> ListShows { get; set; }
 
        public Shows()
        {
            ListShows = new List<Show>();
        }

        public void AddShow(int showId, DateTime showMovieTime, Movie movie, DateTime showDate, ICinema showCinema, double showPrice)
        {
            ListShows.Add(new Show(showId, showMovieTime, movie, showDate, showCinema, showPrice));
        }

        public Show FindShow(DateTime showMovieTime, string movieName)
        {
            Show s = new Show();
            foreach(Show ss in ListShows)
            {
                if ((showMovieTime == ss.ShowMovieTime) && (movieName == ss.ShowMovie.MovieTitle))
                {
                    s = ss;
                }
            }
            return s;
        }

        public void UpdateShow(int showId, DateTime showMovieTime, DateTime NewshowMovieTime, string movieName, Movie movie, DateTime showDate, ICinema showCinema, double showPrice)
        {
            Show s = new Show();
            
            s = FindShow(showMovieTime, movieName);
            s.ShowId = showId;
            s.ShowMovieTime = NewshowMovieTime;
            s.ShowMovie = movie;
            s.ShowDate = showDate;
            s.ShowCinema = showCinema;
            s.ShowPrice = showPrice;
        }

        public void DeleteShow(DateTime showMovieTime, string movieName)
        {
            ListShows.Remove(FindShow(showMovieTime, movieName));
        }

        public void DeleteCustomer(Show s)
        {
            ListShows.Remove(s);
        }
    }
}
